package com.tcd.helper.redis;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;

/**
 * @ClassName : com.tcd.utils.RedisUtil
 * @Description : 描述
 * Author : space
 * CreatedDate 2021-05-26 10:53:16
 */
@Component
public class RedisHelper {

    static RedisTemplate<String,Object> redisTemplate;

    @Autowired
    public static RedisTemplate<String, Object> getRedisTemplate() {
        return redisTemplate;
    }

    @Autowired
    public void setRedisTemplate(RedisTemplate<String, Object> redisTemplate) {
        RedisHelper.redisTemplate = redisTemplate;
    }


    public static Boolean hasKey(String key){
        return redisTemplate.hasKey(key);
    }

    public static void delKey(String key){
        redisTemplate.delete(key);
    }

    public static void rename(String oldName,String newName){
        redisTemplate.rename(oldName,newName);
    }



}
